*******************************************
*** Replication for "Silencing Their Critics: How Government Restrictions Against Civil Society Affect International Naming and Shaming"
*** Authors: Hannah Smidt, Dominic Perera, Neil Mitchell, Kristin Bakke
*** Date: 27.6.2019

log using Output_Appendices, replace text

set more off
version 13.0
clear

//cd " " // Change to the directory where you saved the data and the VarLabels.do

use "dataForAnalysis_v3.dta", clear

destring YEAR, replace
xtset cowcode YEAR

** Labels
do "VarLabels.do"


***************************************************************************************
*** Appendix S4: Different operationalization of independent variable "restrictions"
***************************************************************************************

** Leave out on restriction type at a time

rename REGISTRATION_PROBLEMS REGISTRATION
local varlist "SOME_BANNED VISIT_RESTRICT TRAVEL_RESTRICT FUNDING_INT FUNDING_DOM REGISTRATION CENSOR HARASS_AMOUNT_bi ARREST_bi SURVEIL_bi KILLING_bi"

foreach var in `varlist' {
	 
	 sort cowcode YEAR
	 gen `var'lag1 = `var'[_n-1]
	 gen RESTRICT_`var' = RESTRICT_COUNTdomlag1 - `var'lag1
	 gen RESTRICTsq_`var' = RESTRICT_`var' * RESTRICT_`var'
	 label var RESTRICT_`var' "Restrictions (-- `var' )"
	 label var RESTRICTsq_`var' "Restrictions sq. (-- `var' )"
	 gen RESTRICT_`var'l2 = RESTRICT_`var'[_n-1]
	 gen RESTRICTsq_`var'l2 = RESTRICTsq_`var'[_n-1]
	 gen RESTRICT_`var'l3 = RESTRICT_`var'[_n-2]
	 gen RESTRICTsq_`var'l3 = RESTRICTsq_`var'[_n-2]

	* Negative binomial 
	xtset cowcode YEAR
	#delimit ;
	nbreg urgentActions RESTRICT_`var' RESTRICTsq_`var', vce(cluster cowcode) ;
	#delimit cr

	estat ic
	mat es_ic = r(S)
	mat list es_ic
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4_`var'.doc", replace ///
	keep(RESTRICT_`var' RESTRICTsq_`var') ///
	ctitle("Model 1:") label eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')


	* Negative binomial
	#delimit ;
	nbreg urgentActions RESTRICT_`var' RESTRICTsq_`var'
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1, vce(cluster cowcode);
	#delimit cr

	estat ic
	mat es_ic = r(S)
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4_`var'.doc", append ///
	keep(RESTRICT_`var' RESTRICTsq_`var') ///
	ctitle("Model 2") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')


	* Zero inflated negative binomial 
	#delimit ;
	zinb urgentActions RESTRICT_`var' RESTRICTsq_`var'
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1, 
	inflate(fhbest fhworst UCDP_armedConflictlag1 deathpenalty urgentActionslag1) 
	vce(cluster cowcode); // vuong ;
	#delimit cr

	estat ic
	mat es_ic = r(S)
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4_`var'.doc", append ///
	keep(RESTRICT_`var' RESTRICTsq_`var') ///
	ctitle("Model 3") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')


	
	* GMM
	xtset, clear
	#delimit ;
	ivpoisson gmm urgentActions
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1
	( RESTRICT_`var' RESTRICTsq_`var' = 
		RESTRICT_`var'l2 RESTRICTsq_`var'l2
		RESTRICT_`var'l3)
		, twostep vce(boot, reps(50) cl(cowcode) seed(1)) ;
	#delimit cr
	
	estat overid
	mat es_ic = r(J) 
	matrix list es_ic
	local J: display %4.1f es_ic[1,1]
	outreg2 using ".\Tables\Appendix_TableS4_`var'.doc", append ///
	keep( RESTRICT_`var' RESTRICTsq_`var') ///
	ctitle("Model 4") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Sargan-Hansen-test, `J')


	#delimit ;
	ivpoisson gmm urgentActions
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq 
	hrgroupslag1 hrnewslag1 
	populationlag1  UCDP_armedConflictlag1 
	(RESTRICT_`var' RESTRICTsq_`var'
	PTS_Slag1 PR_freedomHouselag1 PR_freedomHouselag1_sq
	protest_ClarkRegan_loglag1 = 
		RESTRICT_`var'l2 RESTRICTsq_`var'l2
		RESTRICT_`var'l3
		PTS_Slag2 
		PR_freedomHouselag2
		PR_freedomHouselag2_sq 
		protest_ClarkRegan_loglag2 )
	, twostep vce(boot, reps(50) cl(cowcode) seed(1)) ;
	#delimit cr

	estat overid 
	mat es_ic = r(J)  
	 matrix list es_ic
	local J: display %4.1f es_ic[1,1]
	outreg2 using ".\Tables\Appendix_TableS4_`var'.doc", append ///
	 ctitle("Model 5") label  eqdrop(lnalpha) dec(3) ///
	 keep(RESTRICT_`var' RESTRICTsq_`var') ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Sargan-Hansen-test, `J')

}



*** Leave out packages of restrictions

capture drop RESTRICT_1
capture drop RESTRICT_2
capture drop RESTRICT_3
capture drop RESTRICTsq_1
capture drop RESTRICTsq_2
capture drop RESTRICTsq_3

gen RESTRICT_1 = RESTRICT_COUNTdomlag1 - VISIT_RESTRICTlag1 - TRAVEL_RESTRICTlag1 -  FUNDING_INTlag1 - FUNDING_DOMlag1
gen RESTRICTsq_1 = RESTRICT_1 * RESTRICT_1
label var RESTRICT_1 "Restrictions (-- visit, travel, funding)"
label var RESTRICTsq_1 "Restrictions sq."
gen RESTRICT_2 = RESTRICT_COUNTdomlag1 - REGISTRATIONlag1 - CENSORlag1  - SURVEIL_bilag1 - SOME_BANNEDlag1
gen RESTRICTsq_2 = RESTRICT_2 * RESTRICT_2
label var RESTRICT_2 "Restrictions (-- registr., censor, surveil., banned)"
label var RESTRICTsq_2 "Restrictions sq."
gen RESTRICT_3 = RESTRICT_COUNTdomlag1 - HARASS_AMOUNT_bilag1 - ARREST_bilag1 - KILLING_bilag1
gen RESTRICTsq_3 = RESTRICT_3 * RESTRICT_3
label var RESTRICT_3 "Restrictions (-- harass, arrest, killing)"
label var RESTRICTsq_3 "Restrictions sq."

sort cowcode YEAR
gen RESTRICT_1lag2 = RESTRICT_1[_n-1]
gen RESTRICTsq_1lag2 = RESTRICTsq_1[_n-1]
gen RESTRICT_1lag3 = RESTRICT_1[_n-2]
gen RESTRICTsq_1lag3 = RESTRICTsq_1[_n-2]

gen RESTRICT_2lag2 = RESTRICT_2[_n-1]
gen RESTRICTsq_2lag2 = RESTRICTsq_2[_n-1]
gen RESTRICT_2lag3 = RESTRICT_2[_n-2]
gen RESTRICTsq_2lag3 = RESTRICTsq_2[_n-2]

gen RESTRICT_3lag2 = RESTRICT_3[_n-1]
gen RESTRICTsq_3lag2 = RESTRICTsq_3[_n-1]
gen RESTRICT_3lag3 = RESTRICT_3[_n-2]
gen RESTRICTsq_3lag3 = RESTRICTsq_3[_n-2]


* Leave out: VISIT_RESTRICTlag1 - TRAVEL_RESTRICTlag1 -  FUNDING_INTlag1 - FUNDING_DOMlag1

	xtset cowcode YEAR
	
	* Negative binomial 
	#delimit ;
	nbreg urgentActions RESTRICT_1 RESTRICTsq_1, vce(cluster cowcode) ;
	#delimit cr

	estat ic
	mat es_ic = r(S)
	mat list es_ic
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4m.doc", replace ///
	keep(RESTRICT_1 RESTRICTsq_1) ///
	ctitle("Model 1") label eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')

	* Negative binomial
	#delimit ;
	nbreg urgentActions RESTRICT_1 RESTRICTsq_1
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1, vce(cluster cowcode);
	#delimit cr

	estat ic
	mat es_ic = r(S)
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4m.doc", append ///
	keep(RESTRICT_1 RESTRICTsq_1) ///
	ctitle("Model 2") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')

	* Zero inflated negative binomial 
	#delimit ;
	zinb urgentActions RESTRICT_1 RESTRICTsq_1
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1, 
	inflate(fhbest fhworst UCDP_armedConflictlag1 deathpenalty urgentActionslag1) 
	vce(cluster cowcode); // vuong ;
	#delimit cr

	estat ic
	mat es_ic = r(S)
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4m.doc", append ///
	keep(RESTRICT_1 RESTRICTsq_1) ///
	ctitle("Model 3") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')
	
	* GMM
	xtset, clear
	#delimit ;
	ivpoisson gmm urgentActions
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1
	( RESTRICT_1 RESTRICTsq_1 =
		RESTRICT_1lag2 RESTRICT_1lag3 RESTRICTsq_1lag2)
		, twostep vce(boot, reps(50) cl(cowcode) seed(1)) ;
	#delimit cr
	
	estat overid
	mat es_ic = r(J) 
	matrix list es_ic
	local J: display %4.1f es_ic[1,1]
	outreg2 using ".\Tables\Appendix_TableS4m.doc", append ///
	keep( RESTRICT_1 RESTRICTsq_1) ///
	ctitle("Model 4") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Hansen's J, `J')

	#delimit ;
	ivpoisson gmm urgentActions
		gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
		KOFGIlag1 KOFGIlag1_sq 
		hrgroupslag1 hrnewslag1 protest_ClarkRegan_loglag1 
		populationlag1  UCDP_armedConflictlag1 
		(RESTRICT_1 RESTRICTsq_1 
		PTS_Slag1 PR_freedomHouselag1 PR_freedomHouselag1_sq
		= RESTRICT_1lag2 RESTRICT_1lag3 RESTRICTsq_1lag2
		PTS_Slag2 PR_freedomHouselag2 PR_freedomHouselag2_sq)
	, twostep vce(boot, reps(50) cl(cowcode) seed(2)) ;
	#delimit cr

	estat overid 
	mat es_ic = r(J) 
	 matrix list es_ic
	local J: display %4.1f es_ic[1,1]
	outreg2 using ".\Tables\Appendix_TableS4m.doc", append ///
	 ctitle("Model 5") label  eqdrop(lnalpha) dec(3) ///
	 keep(RESTRICT_1 RESTRICTsq_1) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Hansen's J, `J')
	
	
	

	

** REGISTRATION_PROBLEMSlag1 - CENSORlag1  - SURVEIL_bilag1 -- SOME_BANNEDlag1


	xtset cowcode YEAR
	
	* Negative binomial 
	#delimit ;
	nbreg urgentActions RESTRICT_2 RESTRICTsq_2, vce(cluster cowcode) ;
	#delimit cr

	estat ic
	mat es_ic = r(S)
	mat list es_ic
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4l.doc", replace ///
	keep(RESTRICT_2 RESTRICTsq_2) ///
	ctitle("Model 1") label eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')


	* Negative binomial
	#delimit ;
	nbreg urgentActions RESTRICT_2 RESTRICTsq_2
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1, vce(cluster cowcode);
	#delimit cr

	estat ic
	mat es_ic = r(S)
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4l.doc", append ///
	keep(RESTRICT_2 RESTRICTsq_2) ///
	ctitle("Model 2") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')

	* Zero inflated negative binomial 
	#delimit ;
	zinb urgentActions RESTRICT_2 RESTRICTsq_2
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1, 
	inflate(fhbest fhworst UCDP_armedConflictlag1 deathpenalty urgentActionslag1) 
	vce(cluster cowcode); // vuong ;
	#delimit cr

	estat ic
	mat es_ic = r(S)
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4l.doc", append ///
	keep(RESTRICT_2 RESTRICTsq_2) ///
	ctitle("Model 3") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')
	
	
	* GMM
	xtset, clear
	#delimit ;
	ivpoisson gmm urgentActions
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1
	( RESTRICT_2 RESTRICTsq_2 =
		RESTRICT_2lag2 RESTRICT_2lag3 RESTRICTsq_2lag2)
		, twostep vce(boot, reps(50) cl(cowcode) seed(1)) ;
	#delimit cr
	
	estat overid
	mat es_ic = r(J) 
	matrix list es_ic
	local J: display %4.1f es_ic[1,1]
	outreg2 using ".\Tables\Appendix_TableS4l.doc", append ///
	keep( RESTRICT_2 RESTRICTsq_2) ///
	ctitle("Model 4") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Hansen's J, `J')

	#delimit ;
	ivpoisson gmm urgentActions
		gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
		KOFGIlag1 KOFGIlag1_sq 
		hrgroupslag1 hrnewslag1 
		populationlag1  UCDP_armedConflictlag1 
		(RESTRICT_2 RESTRICTsq_2 
		PTS_Slag1 PR_freedomHouselag1 PR_freedomHouselag1_sq
		protest_ClarkRegan_loglag1 = 
		RESTRICT_2lag2 RESTRICT_2lag3 RESTRICTsq_2lag2
		PTS_Slag2 PR_freedomHouselag2 PR_freedomHouselag2_sq
		protest_ClarkRegan_loglag2 )
	, twostep vce(boot, reps(50) cl(cowcode) seed(1)) ;
	#delimit cr

	estat overid 
	mat es_ic = r(J) 
	 matrix list es_ic
	local J: display %4.1f es_ic[1,1]
	outreg2 using ".\Tables\Appendix_TableS4l.doc", append ///
	 ctitle("Model 5") label  eqdrop(lnalpha) dec(3) ///
	 keep(RESTRICT_2 RESTRICTsq_2) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Hansen's J, `J')
	
	

	
** Leave out: HARASS_AMOUNT_bilag1 - ARREST_bilag1 - KILLING_bilag1

	xtset cowcode YEAR
	
	* Negative binomial 
	#delimit ;
	nbreg urgentActions RESTRICT_3 RESTRICTsq_3, vce(cluster cowcode) ;
	#delimit cr

	estat ic
	mat es_ic = r(S)
	mat list es_ic
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4n.doc", replace ///
	keep(RESTRICT_3 RESTRICTsq_3) ///
	ctitle("Model 1") label eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')

	* Negative binomial
	#delimit ;
	nbreg urgentActions RESTRICT_3 RESTRICTsq_3
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1, vce(cluster cowcode);
	#delimit cr

	estat ic
	mat es_ic = r(S)
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4n.doc", append ///
	keep(RESTRICT_3 RESTRICTsq_3) ///
	ctitle("Model 2") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')

	* Zero inflated negative binomial 
	#delimit ;
	zinb urgentActions RESTRICT_3 RESTRICTsq_3
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1, 
	inflate(fhbest fhworst UCDP_armedConflictlag1 deathpenalty urgentActionslag1) 
	vce(cluster cowcode); // vuong ;
	#delimit cr

	estat ic
	mat es_ic = r(S)
	local AIC: display %4.1f es_ic[1,5]
	local BIC: display %4.1f es_ic[1,6]
	local LL: display %4.1f es_ic[1,3]
	outreg2 using ".\Tables\Appendix_TableS4n.doc", append ///
	keep(RESTRICT_3 RESTRICTsq_3) ///
	ctitle("Model 3") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')
		
	* GMM
	xtset, clear
	#delimit ;
	ivpoisson gmm urgentActions
	PTS_Slag1 hrgroupslag1 hrnewslag1 
	protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
	PR_freedomHouselag1 PR_freedomHouselag1_sq 
	gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
	KOFGIlag1 KOFGIlag1_sq populationlag1
	( RESTRICT_3 RESTRICTsq_3 =
		RESTRICT_3lag2 RESTRICT_3lag3 RESTRICTsq_3lag2)
		, twostep vce(boot, reps(50) cl(cowcode) seed(1)) ;
	#delimit cr
	
	estat overid
	mat es_ic = r(J) 
	matrix list es_ic
	local J: display %4.1f es_ic[1,1]
	outreg2 using ".\Tables\Appendix_TableS4n.doc", append ///
	keep( RESTRICT_3 RESTRICTsq_3) ///
	ctitle("Model 4") label  eqdrop(lnalpha) dec(3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Hansen's J, `J')


	#delimit ;
	ivpoisson gmm urgentActions
		gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
		KOFGIlag1 KOFGIlag1_sq 
		hrgroupslag1 hrnewslag1 
		populationlag1  UCDP_armedConflictlag1 
		(RESTRICT_3 RESTRICTsq_3 
		PTS_Slag1 PR_freedomHouselag1 PR_freedomHouselag1_sq
		protest_ClarkRegan_loglag1 = 
		RESTRICT_3lag2 RESTRICT_3lag3 RESTRICTsq_3lag2
		PTS_Slag2 PR_freedomHouselag2 PR_freedomHouselag2_sq
		protest_ClarkRegan_loglag2 )
	, twostep vce(boot, reps(50) cl(cowcode) seed(1)) ;
	#delimit cr

	estat overid 
	mat es_ic = r(J) 
	 matrix list es_ic
	local J: display %4.1f es_ic[1,1]
	outreg2 using ".\Tables\Appendix_TableS4n.doc", append ///
	 ctitle("Model 5") label  eqdrop(lnalpha) dec(3) ///
	 keep(RESTRICT_3 RESTRICTsq_3) ///
	alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
	addtext(Hansen's J, `J')
	
	
	
	
	
****************************************************************************
**** Appendix S5: Regime Types and Restrictions
****************************************************************************
	
gen polity2lag1_sq = polity2lag1*polity2lag1

* Model 2: Negative binomial with robust se
#delimit ;
nbreg urgentActions c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1
PTS_Slag1 hrgroupslag1 hrnewslag1 
protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
PR_freedomHouselag1 PR_freedomHouselag1_sq 
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq populationlag1 
polity2lag1 polity2lag1_sq, vce(cluster cowcode);
#delimit cr

estat ic
mat es_ic = r(S)
mat list es_ic
local AIC: display %4.1f es_ic[1,5]
local BIC: display %4.1f es_ic[1,6]
local LL: display %4.1f es_ic[1,3]
outreg2 using ".\Tables\Appendix_TableS5.doc", replace ///
 ctitle("Model 2") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')

* Model 3: Zero inflated negative binomial 
set seed 2
#delimit ;
zinb urgentActions c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1
PTS_Slag1 hrgroupslag1 hrnewslag1 
protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
PR_freedomHouselag1 PR_freedomHouselag1_sq 
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq populationlag1
polity2lag1 polity2lag1_sq, 
inflate(fhbest fhworst UCDP_armedConflictlag1 deathpenalty urgentActionslag1) 
vce(cluster cowcode); // vuong ;
#delimit cr

estat ic
mat es_ic = r(S)
local AIC: display %4.1f es_ic[1,5]
local BIC: display %4.1f es_ic[1,6]
local LL: display %4.1f es_ic[1,3]
outreg2 using ".\Tables\Appendix_TableS5.doc", append ///
 ctitle("Model 3") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')


** Model 4: GMM (with 2 EEVs)
xtset, clear
#delimit ;
ivpoisson gmm urgentActions
PTS_Slag1 hrgroupslag1 hrnewslag1 
protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
PR_freedomHouselag1 PR_freedomHouselag1_sq 
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq populationlag1
polity2lag1 polity2lag1_sq
( RESTRICT_COUNTdomlag1 RESTRICT_COUNTdomlag1_sq = 
	RESTRICT_COUNTdomlag2 RESTRICT_COUNTdomlag3
	RESTRICT_COUNTdomlag2_sq)
	, twostep vce(boot, reps(50) cl(cowcode) seed(1)) ;
#delimit cr
estat overid

mat es_ic = r(J) 
matrix list es_ic
local J: display %4.1f es_ic[1,1]
outreg2 using ".\Tables\Appendix_TableS5.doc", append ///
 ctitle("Model 4") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
addtext(Hansen's J, `J')


** Model 5: GMM (with all EEVs)
xtset, clear
#delimit ;
ivpoisson gmm urgentActions
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq 
hrgroupslag1 hrnewslag1 
populationlag1  UCDP_armedConflictlag1 
polity2lag1 polity2lag1_sq
(RESTRICT_COUNTdomlag1 RESTRICT_COUNTdomlag1_sq 
PTS_Slag1 PR_freedomHouselag1 PR_freedomHouselag1_sq
protest_ClarkRegan_loglag1 = 
	RESTRICT_COUNTdomlag2 RESTRICT_COUNTdomlag3
	RESTRICT_COUNTdomlag2_sq
	PTS_Slag2 
	PR_freedomHouselag2
	PR_freedomHouselag2_sq 
	protest_ClarkRegan_loglag2 )
, twostep vce(boot, reps(50) cl(cowcode) seed(1)) ;
#delimit cr
estat overid 

mat es_ic = r(J) 
 matrix list es_ic
local J: display %4.1f es_ic[1,1]
outreg2 using ".\Tables\Appendix_TableS5.doc", append ///
 ctitle("Model 5") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
addtext(Hansen's J, `J')



***************************************************************************************
*** Appendix S6: Different operationalization of shaming using Murdie and David's (2012) data.
***************************************************************************************

* Model 1: Negative binomial with robust standard errors
#delimit ;
nbreg shamingINGO c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1, vce(cluster cowcode) ;
#delimit cr

estat ic
mat es_ic = r(S)
mat list es_ic
local AIC: display %4.1f es_ic[1,5]
local BIC: display %4.1f es_ic[1,6]
local LL: display %4.1f es_ic[1,3]
outreg2 using ".\Tables\Appendix_TableS6.doc", replace ///
 ctitle("Model 1") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')


margins, at(RESTRICT_COUNTdomlag1 = (0(1)10) )
marginsplot, recast(line) recastci(rarea)  ///
plotopt(color(gs0) lwidth(1) ) ///
ciopt(color(gs6) fintensity(10) lcolor(gs16) ) ///
xtitle("Count of restriction types", size(large)) ///
ytitle("Predicted number of media shaming events", size(large)) ///
title("Model 1", size(large)) ///
scheme(s1mono)
graph export ".\Figures\Appendix_FigureS6_1.png", replace


* Negative binomial with robust se
#delimit ;
nbreg shamingINGO c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1
PTS_Slag1 hrgroupslag1 hrnewslag1 
protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
PR_freedomHouselag1 PR_freedomHouselag1_sq 
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq populationlag1, vce(cluster cowcode);
#delimit cr

estat ic
mat es_ic = r(S)
local AIC: display %4.1f es_ic[1,5]
local BIC: display %4.1f es_ic[1,6]
local LL: display %4.1f es_ic[1,3]
outreg2 using ".\Tables\Appendix_TableS6.doc", append ///
 ctitle("Model 2") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')

margins, at(RESTRICT_COUNTdomlag1 = (0(1)10) ) post
marginsplot, recast(line) recastci(rarea)  ///
plotopt(color(gs0) lwidth(1) ) ///
ciopt(color(gs6) fintensity(10) lcolor(gs16) ) ///
xtitle("Count of restriction types", size(large)) ///
ytitle("Predicted number of media shaming events", size(large)) ///
title("Model 2 (INGOs)", size(large)) ///
scheme(s1mono)
graph export ".\Figures\Appendix_FigureS6_2.png", replace


* Zero inflated negative binomial 
set seed 2
#delimit ;
zinb shamingINGO c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1
PTS_Slag1 hrgroupslag1 hrnewslag1 
protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
PR_freedomHouselag1 PR_freedomHouselag1_sq 
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq populationlag1, 
inflate(fhbest fhworst UCDP_armedConflictlag1 shamingINGOlag1) 
vce(cluster cowcode); // vuong ;
#delimit cr

estat ic
mat es_ic = r(S)
local AIC: display %4.1f es_ic[1,5]
local BIC: display %4.1f es_ic[1,6]
local LL: display %4.1f es_ic[1,3]
outreg2 using ".\Tables\Appendix_TableS6.doc", append ///
 ctitle("Model 3") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')

margins, at(RESTRICT_COUNTdomlag1 = (0 4)) contrast(atcontrast(r)) //   .1116074   .1444988     -.1716051      .39482
margins, at(RESTRICT_COUNTdomlag1 = (4 10)) contrast(atcontrast(r)) //   -.3770978   .1572203      -.685244   -.0689516

margins, at(RESTRICT_COUNTdomlag1 = (0(1)10) ) post
marginsplot, recast(line) recastci(rarea)  ///
plotopt(color(gs0) lwidth(1) ) ///
ciopt(color(gs6) fintensity(10) lcolor(gs16) ) ///
xtitle("Count of restriction types", size(large)) ///
ytitle("Predicted number of media shaming events", size(large)) ///
title("Model 3 (INGOs)", size(large)) ///
scheme(s1mono)
graph export ".\Figures\Appendix_Figure6_3.png", replace





***************************************************************************
**** Appendix S7: Fixed effects models
***************************************************************************

xtset cowcode YEAR

* Poisson RANDOM EFFECTS
#delimit ;
xtpoisson urgentActions c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1, re;
#delimit cr
estimates store random
* Poisson FIXED EFFECTS
#delimit ;
xtpoisson urgentActions c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1, fe;
#delimit cr
estimates store fixed
hausman random fixed

estat ic
mat es_ic = r(S)
mat list es_ic
local AIC: display %4.1f es_ic[1,5]
local BIC: display %4.1f es_ic[1,6]
local LL: display %4.1f es_ic[1,3]
outreg2 using ".\Tables\Appendix_TableS7.doc", replace ///
 ctitle("Model 1") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')



* Poisson FIXED EFFECTS
#delimit ;
quietly xtpoisson urgentActions c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1
PTS_Slag1 hrgroupslag1 hrnewslag1 
protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
PR_freedomHouselag1 PR_freedomHouselag1_sq 
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq populationlag1 i.YEAR, fe;
estimates store fixed ;
#delimit cr
* Poisson RANDOM EFFECTS
#delimit ;
quietly xtpoisson urgentActions c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1
PTS_Slag1 hrgroupslag1 hrnewslag1 
protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
PR_freedomHouselag1 PR_freedomHouselag1_sq 
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq populationlag1 i.YEAR, re;
estimates store random ;
#delimit cr
hausman fixed random


** Poisson with FE
set seed 2
#delimit ;
xtpoisson urgentActions c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1
PTS_Slag1 hrgroupslag1 hrnewslag1 
protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
PR_freedomHouselag1 PR_freedomHouselag1_sq 
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq populationlag1, fe ;
#delimit cr

estat ic
mat es_ic = r(S)
local AIC: display %4.1f es_ic[1,5]
local BIC: display %4.1f es_ic[1,6]
local LL: display %4.1f es_ic[1,3]
outreg2 using ".\Tables\Appendix_TableS7.doc", append ///
 ctitle("Model 2") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) ///
addtext(Log-Likelihood, `LL', BIC, `BIC', AIC, `AIC')




***************************************************************************
**** Appendix S8: Population Average Models
***************************************************************************

* Negative binomial Population averaged
#delimit ;
xtnbreg urgentActions c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1, pa corr(ar 1);
#delimit cr

outreg2 using ".\Tables\Appendix_TableS8.doc", append ///
 ctitle("Model 3") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +) 

margins, at(RESTRICT_COUNTdomlag1 = (0 6)) contrast(atcontrast(r)) //  10.06674   2.769525      4.638568    15.49491
margins, at(RESTRICT_COUNTdomlag1 = (6 10)) contrast(atcontrast(r)) // -8.209127   2.678666     -13.45921   -2.959038

margins, at(RESTRICT_COUNTdomlag1 = (0(1)10) )
marginsplot, recast(line) recastci(rarea)  ///
plotopt(color(gs0) lwidth(1) ) ///
ciopt(color(gs6) fintensity(10) lcolor(gs16) ) ///
xtitle("Count of restriction types", size(large)) ///
ytitle("Predicted number of UAs", size(large)) ///
title("Model 1", size(large)) ///
scheme(s1mono)


* Negative binomial Population averaged
set seed 2
#delimit ;
xtnbreg urgentActions c.RESTRICT_COUNTdomlag1##c.RESTRICT_COUNTdomlag1
PTS_Slag1 hrgroupslag1 hrnewslag1 
protest_ClarkRegan_loglag1 UCDP_armedConflictlag1 
PR_freedomHouselag1 PR_freedomHouselag1_sq 
gdp_pc_constantUS2010lag1 gdp_pc_constantUS2010lag1_sq 
KOFGIlag1 KOFGIlag1_sq populationlag1, pa corr(ar 1) tol(0.01) ;
#delimit cr

outreg2 using ".\Tables\Appendix_TableS8.doc", append ///
 ctitle("Model 2") label  eqdrop(lnalpha) dec(3) ///
alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**, *, +)

margins, at(RESTRICT_COUNTdomlag1 = (0 8)) contrast(atcontrast(r)) // .324735    .172486     -.0133314    .6628013
margins, at(RESTRICT_COUNTdomlag1 = (8 10)) contrast(atcontrast(r)) //-.0949212   .1362447      -.361956    .1721136

margins, at(RESTRICT_COUNTdomlag1 = (0(1)10) )
marginsplot, recast(line) recastci(rarea)  ///
plotopt(color(gs0) lwidth(1) ) ///
ciopt(color(gs6) fintensity(10) lcolor(gs16) ) ///
xtitle("Count of restriction types", size(large)) ///
ytitle("Predicted number of UAs", size(large)) ///
title("Model 4", size(large)) ///
scheme(s1mono)


log close



